package com.lightheart.sphr.xiaobinggan.bottom.ui

import android.graphics.Typeface
import com.lightheart.sphr.xiaobinggan.R
import com.lightheart.sphr.xiaobinggan.base.BaseActivity
import com.lightheart.sphr.xiaobinggan.bottom.adapter.ScreenSlidePagerAdapter
import com.lightheart.sphr.xiaobinggan.module.home.presenter.HomePresenter
import kotlinx.android.synthetic.main.activity_floating_top_bar.*

class FloatingTopBarActivity : BaseActivity<HomePresenter>() {

    override fun getLayoutId() = R.layout.activity_floating_top_bar

    override fun initInjector() {

    }

    override fun initView() {

//        val fromAsset = Typeface.createFromAsset(this.assets, "rubik.ttf")
//        floating_top_bar_navigation.setTypeface(fromAsset)
        floating_top_bar_navigation.setBadgeValue(0, "3")
        floating_top_bar_navigation.setBadgeValue(1, "9+") //invisible badge

        val fragList = ArrayList<ScreenSlidePageFragment>()
        fragList.add(ScreenSlidePageFragment.newInstance(getString(R.string.home), R.color.red_inactive))
        fragList.add(ScreenSlidePageFragment.newInstance(getString(R.string.search), R.color.blue_inactive))
        fragList.add(ScreenSlidePageFragment.newInstance(getString(R.string.likes), R.color.blue_grey_inactive))
        fragList.add(ScreenSlidePageFragment.newInstance(getString(R.string.notification), R.color.green_inactive))
        val pagerAdapter = ScreenSlidePagerAdapter(fragList, supportFragmentManager)
        view_pager.adapter = pagerAdapter
        //disable swipe
        view_pager.setOnTouchListener { _, _ ->
            return@setOnTouchListener true
        }

        floating_top_bar_navigation.setNavigationChangeListener { _, position ->
            view_pager.setCurrentItem(position, true)
        }
    }
}